﻿using GedeaProject.Business.Parsers;
using GedeaProject.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GedeaProject.Business
{
    public class TextDebitFormatter
    {
        public string GetFormattedText(DebitOrder debitOrder)
        {
            int registryIndex = 0;
            StringBuilder resultBuilder = new StringBuilder();

            foreach(var transaction in debitOrder.Transactions)
            {
                var transactionParser = new TransactionTextDebitParser(transaction, debitOrder.Company);
                resultBuilder.Append(transactionParser.GetFormattedText(registryIndex));
                registryIndex++;
            }

            return resultBuilder.ToString();
        }
    }
}
